#ifndef CORE
#define CORE

#include "typedef.hpp"

class CalcCore
{
private:
	MessageBus *bus;
	uint64_t iregs[32][2];
	float fregs[32];
	double dregs[32];
	CoreBus *cbus;
	struct Ins
	{
		uint8_t op, op2;
		uint8_t rd, rs1, rs2, type;
		int32_t imm;
	} IR;
	int ID;
	const uint8_t ISA = 0x0f;

public:
	CalcCore() : bus(nullptr), cbus(nullptr), IR({0, 0, 0, 0, 0}),ID(0) {};
	CalcCore(MessageBus *, CoreBus *, int);
	~CalcCore() = default;
	CalcCore &operator=(const CalcCore &);
	// 分类型的指令
	void exeI();
	void exeF();
	void exeM();
	void exeC();
	// 指令流水线
	void fetch();
	void decode();
	void execute();
	void memory();
	void post();
	void run();
};

#endif